<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>
</head>
<style>
    div {
    width: 100px;
    height: 100px;
    border: 1px solid red;
  }
</style>
<body>
    <button id="myBtn">按下事件</button>
    <button id="myBtn2">释放事件</button>
    <button id="myBtn3">键盘事件</button>
    <div id="myDiv"> </div>
    <script>
        var myBtn = document.getElementById("myBtn");
        var myBtn2 = document.getElementById("myBtn2");
        var myBtn3 = document.getElementById("myBtn3");

        myBtn.onmousedown = function() {
            console.log("鼠标按下");
        }
        myBtn2.onmouseup = function() {
                console.log("鼠标释放");
        }
        myBtn3.onkeydown = function() {
            console.log("键盘按下");
            }
            var myDiv = document.getElementById("myDiv");
            myDiv.onmousemove = function(event) {
                console.log("鼠标移动");
                    console.log(event.clientX, event.clientY);
                    }
                    myDiv.onmouseout = function() {
                        console.log("鼠标移出");
                        }
                  
    </script>
</body>
</html>